import {getUserInfo} from '@/api/user'

export default{
  namespaced: true,
  state:{
    userInfo: null
  },
  mutations: {
    setUserinfo(state,payload){
      // console.log(payload);
      state.userInfo = payload
    }
  },
  actions: {
    // 获取用户信息
    async getUserInfo(store){
      const res = await getUserInfo()
      
      store.commit('setUserinfo', {...store.state.userinfo,...res.data})
    }
  },
  getters: {
    userInfoGetters(state){
      return state.userInfo
    }
  }
}